import psycopg2

conn = psycopg2.connect(
    dbname="vastbase",
    user="zxs",
    password="Aa123456",
    host="172.16.55.184",
    port="5432"
)

# sql = "create table t4(name varchar(1000)) "
# cur = conn.cursor()
# cur.execute(sql)
#
# sql = "insert into t4 values('zhangxishun') "
# cur.execute(sql)

cur = conn.cursor()
sql = "select * from t4"
cur.execute(sql)
result = cur.fetchall()
for item in result:
    print(item)

conn.commit()
cur.close()
conn.close()


